﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ET.DBCommon.Model
{
    /// <summary>
    /// 结果任务步骤
    /// </summary>
    public class ExamresultsTestQuestionTaskStepModel : NotifyPropertyChanged
    {
        /// <summary>
        /// 编号
        /// </summary>
        public int ID { get; set; }
        /// <summary>
        /// 所属任务
        /// </summary>
        public int ExamresultsTestQuestionTaskID { get; set; }
        /// <summary>
        /// 步骤编号（外键）
        /// </summary>
        public int StepID { get; set; }
        /// <summary>
        /// 参数
        /// </summary>
        public string Parameter { get; set; }
        /// <summary>
        /// 配分
        /// </summary>
        public decimal Score { get; set; }
        /// <summary>
        /// 系统类型
        /// 1/信号2/调度电话3/无线电台
        /// </summary>
        public int SystemType { get; set; }
        /// <summary>
        /// 任务类型
        /// 1/仿真2/作业
        /// </summary>
        public int TaskType { get; set; }
        /// <summary>
        /// 步骤描述
        /// </summary>
        public string StepDescribe { get; set; }
        /// <summary>
        /// 设备类型（外键）
        /// </summary>
        public int DevType { get; set; }
        /// <summary>
        /// 设备编号（外键）
        /// </summary>
        public string DevID { get; set; } = "";
        /// <summary>
        /// 评分标准（1,2,3,4,5,6,7）
        /// 1接听时间_扣分
        /// 2命令要素不全_扣分
        /// 3命令发布时间_扣分
        /// 4重发次数_扣2分
        /// 5重发次数_扣0.5分
        /// 6未执行_扣分
        /// 7未呼叫全线_扣分
        /// </summary>
        public string ScoreStandard { get; set; }
        /// <summary>
        /// 文本
        /// </summary>
        public string StepContent { get; set; } = "";
        /// <summary>
        /// 前提条件
        /// 1/列车位置（车次/逻辑区段）
        /// 2/事前步骤（步骤编号/延迟时间）
        /// 3/设备状态（设备类型/设备编号/设备状态）
        /// </summary>
        public string Prerequisite { get; set; }
        public string StrOperationScore { get; set; }
        /// <summary>
        /// 操作得分
        /// </summary>
        private decimal m_OperationScore;
        public decimal OperationScore
        {
            get
            {
                return this.m_OperationScore;
            }
            set
            {
                this.m_OperationScore = value;
                this.OnPropertyChanged("OperationScore");
                this.StrOperationScore = "【" + Score.ToString() + " / " + value.ToString() + "】";
                this.OnPropertyChanged("StrOperationScore");
            }
        }
        /// <summary>
        /// 结果得分
        /// </summary>
        public decimal ResultScore { get; set; }
        /// <summary>
        /// 时间得分
        /// </summary>
        public decimal TimeScore { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime OperationTime { get; set; }
        /// <summary>
        /// 占比
        /// </summary>
        public decimal Proportion { get; set; }
        /// <summary>
        /// 总分
        /// </summary>
        private decimal m_TotalScore;
        public decimal TotalScore
        {
            get
            {
                return this.m_TotalScore;
            }
            set
            {
                this.m_TotalScore = value;
                this.OnPropertyChanged("TotalScore");
            }
        }
        /// <summary>
        /// 综合分
        /// </summary>
        private decimal m_CompositeScore;
        public decimal CompositeScore
        {
            get
            {
                return this.m_CompositeScore;
            }
            set
            {
                this.m_CompositeScore = value;
                this.OnPropertyChanged("CompositeScore");
            }
        }
        /// <summary>
        /// 状态
        /// 1/正确
        /// 2/错误
        /// 3/跳过
        /// </summary>
        public int State { get; set; }
        /// <summary>
        /// 执行次数
        /// </summary>
        public int ExecTimes { get; set; }
        /// <summary>
        /// 录音文件
        /// </summary>
        private byte[] m_AudioFile;
        public byte[] AudioFile
        {
            get
            {
                return this.m_AudioFile;
            }
            set
            {
                this.m_AudioFile = value;
                this.OnPropertyChanged("AudioFile");
            }
        }
        /// <summary>
        /// 执行状态
        /// 1/已执行
        /// 2/未执行
        /// 3/执行中
        /// </summary>
        private int m_ExecState;
        public int ExecState
        {
            get
            {
                return this.m_ExecState;
            }
            set
            {
                this.m_ExecState = value;
                this.ExecStateName = ExecState == 1 ? "已执行" : (ExecState == 3 ? "执行中" : "未执行");
                this.OnPropertyChanged("ExecState");
            }
        }

        private string m_ExecStateName;
        public string ExecStateName
        {
            get
            {
                return this.m_ExecStateName;
            }
            set
            {
                this.m_ExecStateName = value;
                this.OnPropertyChanged("ExecStateName");
            }
        }
        /// <summary>
        /// 关键字（逗号分隔）
        /// </summary>
        public string Keyword { get; set; } = "";
        /// <summary>
        /// 
        /// </summary>
        public int TestQuestionTaskStepID { get; set; }
        /// <summary>
        /// 执行顺序
        /// </summary>
        public int Order { get; set; }
        /// <summary>
        /// 是否需要复述
        /// </summary>
        public bool IsRepeat { get; set; }
        /// <summary>
        /// 任务开始时间
        /// </summary>
        public DateTime BeginTime { get; set; }
        /// <summary>
        /// 任务结束时间
        /// </summary>
        public DateTime EndTime { get; set; }
        /// <summary>
        /// 是否命令
        /// </summary>
        public bool IsCommand { get; set; }
        /// <summary>
        /// 扩展字段
        /// 错误次数
        /// </summary>
        public int ErrorCount { get; set; }


        /// <summary>
        /// 扣分说明
        /// </summary>
        private string m_ScoreDescribe;
        public string ScoreDescribe
        {
            get
            {
                return this.m_ScoreDescribe;
            }
            set
            {
                this.m_ScoreDescribe = value;
                this.OnPropertyChanged("ScoreDescribe");
            }
        }

        /// <summary>
        /// 区间外执行扣分值
        /// </summary>
        public decimal OutRangeScore;
        /// <summary>
        /// 互斥字段
        /// </summary>
        public string MutexStep { get; set; }
        /// <summary>
        /// 是否限制发布时长
        /// </summary>
        public bool LimitedDuration { get; set; }
        /// <summary>
        /// 发布时长
        /// </summary>
        public int Duration { get; set; }
        /// <summary>
        /// 超时扣分值
        /// </summary>
        public decimal Deduction { get; set; }
        /// <summary>
        /// 是否为关键步骤
        /// </summary>
        public bool IsKeyStep { get; set; }

        /// <summary>
        /// 步骤编号（外键）1
        /// </summary>
        public int StepID1 { get; set; }
        /// <summary>
        /// 步骤描述1
        /// </summary>
        public string StepDescribe1 { get; set; }
        /// <summary>
        /// 设备类型（外键）1
        /// </summary>
        public int DevType1 { get; set; }
        /// <summary>
        /// 设备编号（外键）1
        /// </summary>
        public string DevID1 { get; set; } = "";
        /// <summary>
        /// 参数1
        /// </summary>
        public string Parameter1 { get; set; }
        /// <summary>
        /// 是否为多步判断
        /// </summary>
        public bool Estimate { get; set; }


    }
}
